/*
 * Middleware
 * Copyright (C) 2010/11
 * Marco Buzzanca, Davide Giuseppe Monaco, Riccardo Pulvirenti, Giuseppe Ravidà,
 * Andrea Tino
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANDABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses
 */

/*!
 * File: file_cta_proxy_test.hpp
 */

#ifndef FILE_CTA_PROXY_TEST_HPP_
#define FILE_CTA_PROXY_TEST_HPP_

#include <iostream>
#include <string>
#include <boost/thread/mutex.hpp>
#include <boost/thread.hpp>

#include "file_cta_proxy.hpp"

namespace middleware {
//-----------------------------------------------------------------------------
// Definitions
void FileCTAProxyTest();
//-----------------------------------------------------------------------------
// Implementations
void FileCTAProxyTest() {
	FileCTAProxy proxy(20000, std::string("cta_try.txt"), kOpenOverwrite);
	std::cout << "Created, now writing in" << std::endl;
	for (int i = 0; ; i++) {
		std::stringstream ss;
		ss << "This is the " << i << " line content." << std::endl;
		proxy << ss.str();
		std::cout << "Inserted" << std::endl;
		boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
	}
}
} /* middleware */

#endif
